<?php
/**
 * reg.php - register fuction, talk to database
 *
 * NMIT BIT Project - Infinity - A 3D Website using WebGL & HTML5 Technology
 * Infinity Grid Version 
 * Version: 1.0 Beta 2
 *
 * Infinity - Login function test
 *
 * Author: William Liu <qzliuyuzou@gmail.com> <lyzdev@gmail.com>
 *
 * Required Server Version:
 *  PHP5 or higher
 *  MySQL 5 or higher
 *
 * Required Browser Version:
 *  Google Chrome 9 or higher
 *  Mozilla Firefox 4 Beta or higher
 *  *Apple Safari
 *
 * Copyright (c) 2011, William Liu All rights reserved.
 * Infinity is an open source 3D website project
 * Under Apache License 2.0
 * http://www.lyzsoft.cn
 * http://7cloud.wordpress.com
 *
 * Project Starting date: 9/3/2011
 * Update Date 1: 6/4/2011
 *
**/
?>

<?php  
@mysql_connect("localhost", "root","P@ssword1")               //mysql connection  
or die("Database Connection Fail!");  
@mysql_select_db("PRJ_Nova")                    //slect database  
or die("The Database is not available!");  
  
//Get user input from form(regiester.php)
$username = $_POST['username'];  
$password = $_POST['password'];
$user_Level = $_POST['level'];

//SQL query and get session value  
$query = @mysql_query("insert into users (username, password, user_level) VALUES ('$username', '$password', '$user_Level')")
or die("SQL query fail!");  
//return information
if($row = mysql_fetch_array($query))  
{
	echo "Success";
}  
else
{  
    echo "Error";  
}  
?>  